<template>
	<view class="repair">
		<view style="width: 100%;background-color: #FFFFFF;">
			<view class="cardCon" style="background-color: #FFFFFF;">
				<view class="list-li">
					<view class="list-name">
						<text style="color: #000000;font-weight: 700;font-size: 18px;">{{userObj.manual_name}}</text>
					</view>
				</view>
				<view class="list_text">
					<view class="list_text_name">
						<text style="color: #578EF0;font-size: 14px;">分类：{{userObj.manual_typename}}</text>
						<text style="color: #ffaa00;font-size: 14px;float: right;" @click="videoPopover" v-if="userObj.video_link!=null">视频教程</text>
					</view>
				</view>
				<view v-for="(item,index) in userObj.detailList" :key="index">
					<view class="list_text">
						<view class="list_text_name">
							<text style="color: #578EF0;font-size: 14px;">步骤{{index+1}}：</text>
						</view>
					</view>
					<view class="list_text">
						<view class="list_text_name">
							<text style="font-size: 14px;">{{item.manual_illustrate}}</text>
						</view>
					</view>
					<view class="list-img" v-if="item.manual_image1!=null">
						<view>
							<image style="width: 200px;height: 150px;" @click="preview(item.manual_image1)" :src="item.manual_image1"></image>
						</view>
					</view>
					<view class="list-img" v-if="item.manual_image2!=null">
						<view>
							<image style="width: 200px;height: 150px;" @click="preview(item.manual_image2)" :src="item.manual_image2"></image>
						</view>
					</view>
					<view class="list-img" v-if="item.manual_image3!=null">
						<view>
							<image style="width: 200px;height: 150px;" @click="preview(item.manual_image3)" :src="item.manual_image3"></image>
						</view>
					</view>
				</view>
				
			</view>
		</view>

		<view class="modal" v-if="unbinding">
			<view class="modal-cont">
				<view style="width: 100%;background: #e5e5e5;text-align: center;border-radius: 10px 10px 0px 0px;">
					<view class="modal-title">用户手册视频教程</view>
				</view>
				<show-modal style="margin-top: 1px;">
					<video 
						id="myVideo" 
						:src="userObj.video_link" 
						:poster="poster" 
						:show-center-play-btn="true" 
						:enable-play-gesture="true" 
						controls 
						loop 
						class="p-video">
					</video>
				</show-modal>
				<view class="modal-bottom">
					<view class="btn-cancel" @click="unbinding = false">关 闭</view>
				</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	
	export default {
		data() {
			return {
				typeName: '',
				loading: false,
				type: 1,
				userObj:{},
				unbinding:false,
			};
		},
		onLoad(options) {
			const item = JSON.parse(decodeURIComponent(options.item));
			this.userObj = item
			console.log(this.userObj)
		},
		
		methods: {
			// 图片预览
			preview(item) {
				uni.previewImage({
					urls: [item],
					current: 0,
					longPressActions: {
						success: function(data) {
							console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
						},
						fail: function(err) {
							console.log(err.errMsg);
						}
					}
				});
			},
			videoPopover(){
				this.unbinding = true
			}
		},
		onReady() {}
	};
</script>

<style>
	.repair {
		width: 100%;
		
		
	}
	.cardCon{
		width: 90%;
		margin: 20px auto;
		padding-bottom: 48px;
	}
	.list-li{
		
	}
	.list_text_name{
		padding-top: 10px;
	}
	.list-img{
		padding-top: 10px;
	}
	.modal {
		/* width: 100%;
		height: 100vh;
		position: fixed;
		top: 0;
		bottom: 0;
		left: 0;
		right: 0;
		background: rgba($color: #000000, $alpha: 0.6);
		z-index: 999; */
		position: fixed;
		top: 0%;
		left: 0%;
		width: 100%;
		height: 100%;
		background-color: rgba(0, 0, 0, 0.8);
		z-index: 10;
	}
	.modal-cont {
		width: 630rpx;
		// min-height: 420rpx;
		background: #ffffff;
		box-shadow: 0rpx 6rpx 12rpx 0rpx rgba(0, 0, 0, 0.12);
		border-radius: 24rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
		position: absolute;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);
	}
	
	.modal-title {
		font-size: 32rpx;
		font-family: PingFangSC-Medium, PingFang SC;
		font-weight: 500;
		color: #333333;
		line-height: 45rpx;
		margin-top: 22rpx;
	}
	.modal-bottom {
		width: 100%;
		height: 84rpx;
		border-top: 1rpx solid #e6e9ed;
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-top: 2rpx;
	}
	.btn-cancel {
		width: 100%;
		height: 84rpx;
		text-align: center;
		line-height: 84rpx;
		/* border-right: 1rpx solid #d8d8d8; */
		font-size: 28rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #333333;
		box-sizing: border-box;
		background: #e5e5e5;
		border-radius: 0px 0px 10px 10px;
	}
</style>
